<?php

// $Id$

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/menu/tcms_menu_type_dbc.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/menu/tcms_menu_deleter.class.php');


class TCMS_Menu_Type_Deleter extends Tangra_Class {
	public static function delete(DB_Connection $dbc, $menu_type_id, $hidden_inc_dir, $user_id) {
		tangra_if_not_int_throw_e($menu_type_id);
		$sql = "select id from tcms_menus where type = $menu_type_id";
		$rez = $dbc->execute($sql);
		while ($rez_obj = $rez->fetch_object()) {
			TCMS_Menu_Deleter::delete($dbc, $rez_obj->ID, $hidden_inc_dir, $user_id);
		}


		TCMS_Menu_Type_DBC::delete($dbc, $menu_type_id);
	}
}